<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 17-4-13
 * Time: 14:29
 */


namespace frontend\widget;

use Yii;
use yii\helpers\Url;

use yii\base\Widget;
use yii\helpers\Html;

class TopNavWidget extends Widget
{
    public function run()
    {
        $userNotice = '';
          if(Yii::$app->user->isGuest){
                        $userNotice .= '您好 ，欢迎来到京西！';
                        $userNotice .= Html::a('[登录]',Url::to(['member/login']));
          }else{
                        $userNotice.= '您好 '.Yii::$app->user->identity->username.'，欢迎来到京西！';
                         $userNotice .= Html::a('[注销]',Url::to(['member/logout']));
          }
        $orderList = Url::to(['order/list']);

        $registCode =Html::a('[免费注册]',Url::to(['member/regist']));
        return <<<HEAD

<div class="topnav">
    <div class="topnav_bd w990 bc">
        <div class="topnav_left">

        </div>
        <div class="topnav_right fr">
            <ul>
                <li>{$userNotice} {$registCode}</li>
                <li class="line">|</li>
                <li><a href="{$orderList}">我的订单</a></li>
                <li class="line">|</li>
                <li>客户服务</li>

            </ul>
        </div>
    </div>
</div>
HEAD;

    }


}